package com.unieagle.exam.utils;

import java.text.SimpleDateFormat;
import java.util.TimeZone;

public class DateUtils
{
    public static String getDate(long timestamp)
    {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        format.setTimeZone(TimeZone.getTimeZone("gmt"));
        String date = format.format(timestamp);
        return date;
    }
    
    public static String getLeftTime(int seconds)
    {
        int h = seconds / 3600;
        int m = (seconds - h * 3600) / 60;
        int s = seconds - h * 3600 - m * 60;
        String m_string = m > 9 ? m + "" : "0" + m;
        String s_string = s > 9 ? s + "" : "0" + s;
        return String.format("%d:%s:%s", h, m_string, s_string);
    }

}